package cn.zhuoluodada.opensource.smartdb.sqlbuilder.impl.sqlserver;


import cn.zhuoluodada.opensource.smartdb.SmartDb;
import cn.zhuoluodada.opensource.smartdb.sqlbuilder.*;
import cn.zhuoluodada.opensource.smartdb.sqlbuilder.*;
import cn.zhuoluodada.opensource.smartdb.sqlbuilder.convertor.ColumnNameConverter;
import cn.zhuoluodada.opensource.smartdb.sqlbuilder.convertor.TableNameConverter;

public class SqlServerBuilderFactory implements SqlBuilderFactory {
    @Override
    public InsertSqlBuilder insert(TableNameConverter tableNameConverter, ColumnNameConverter columnNameConverter) {
        return new SqlServerInsertSqlBuilder(tableNameConverter, columnNameConverter);
    }

    @Override
    public UpdateSqlBuilder update(TableNameConverter tableNameConverter, ColumnNameConverter columnNameConverter) {
        return new SqlServerUpdateSqlBuilder(tableNameConverter, columnNameConverter);
    }

    @Override
    public DeleteSqlBuilder delete(TableNameConverter tableNameConverter, ColumnNameConverter columnNameConverter) {
        return new SqlServerDeleteSqlBuilder(tableNameConverter, columnNameConverter);
    }

    @Override
    public SelectSqlBuilder select(TableNameConverter tableNameConverter, ColumnNameConverter columnNameConverter) {
        return new SqlServerSelectSqlBuilder(tableNameConverter, columnNameConverter);
    }

    @Override
    public InsertSqlBuilder insert(SmartDb smartDb) {
        return new SqlServerInsertSqlBuilder(smartDb);
    }

    @Override
    public UpdateSqlBuilder update(SmartDb smartDb) {
        return new SqlServerUpdateSqlBuilder(smartDb);
    }

    @Override
    public DeleteSqlBuilder delete(SmartDb smartDb) {
        return new SqlServerDeleteSqlBuilder(smartDb);
    }

    @Override
    public SelectSqlBuilder select(SmartDb smartDb) {
        return new SqlServerSelectSqlBuilder(smartDb);
    }

    @Override
    public String wrapSpecialCharacterField(String field) {
        StringBuilder sb = new StringBuilder();
        return sb.append(SqlserverConst.RESERVED_WORD_CHAR_PREFIX).append(field).append(SqlserverConst.RESERVED_WORD_CHAR_SUFFIX).toString();
    }
}
